package com.zwps.biz.controller.http;


import com.zwps.biz.api.model.dto.strsvrr.StRsvrRDTO;
import com.zwps.biz.api.model.vo.pubpointall.PubPointCountVO;
import com.zwps.biz.api.model.vo.pubpointall.RzRationVO;
import com.zwps.biz.api.model.vo.strsvrr.*;
import com.zwps.biz.dal.db.object.StRsvrRDO;
import com.zwps.biz.domain.service.PubPointAllService;
import com.zwps.biz.domain.service.StRsvrRService;
import com.zwps.biz.domain.service.ZEmergencyUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author dzc
 * @date 2024/9/18 19:59
 * @description
 *
 */


@RestController
@Validated
@Tag(name = "工程概况")
@RequestMapping("brief/water_situation")
public class StRsvrRController {

    @Autowired
    private StRsvrRService  stRsvrRService;

    @Autowired
    private ZEmergencyUserService zEmergencyUserService;

    @Autowired
    private PubPointAllService pubPointAllService;

    @Operation(summary = "查询水情概况")
    @PostMapping("information")
    public List<StRsvrRVO> getStrSvrR(@Valid @NotNull @RequestBody StRsvrRDTO ids) {
        return  stRsvrRService.getStrSvrR(ids);
    }

    @Operation(summary = "水情趋势图初始数据")
    @GetMapping("informationInit/{stcd}")
    public List<StRsvrInitVO> getInitStrSvrR(@Valid @NotBlank @PathVariable String stcd) {
        return  stRsvrRService.getInitStrSvrR(stcd);
    }

    @GetMapping("monitor/{stcd}")
    @Operation(summary = "实时水情监测")
    public GetLastStRsvrRVO getLastStRsvrR(@Valid @NotBlank @PathVariable String stcd) {


        return stRsvrRService.getLastStRsvrR(stcd);
    }


    @GetMapping("station_code")
    @Operation(summary = "获取测站")
    public List<String> getStcd() {

        return stRsvrRService.getStcd();
    }
    @GetMapping("LatestValue")
    @Operation(summary = "获取各雨量站最新值")
    public List<GetLastValueVO> getLatestValue() {

        return stRsvrRService.getLatestValue();
    }

    @GetMapping("getHistoryValue")
    @Operation(summary = "获取雨量站历史数据")
    public List<GetLastValueVO> getHistoryValue(@RequestParam(value = "stcd" ) String stcd,
                                                @RequestParam (value = "type") Integer type,
                                                @RequestParam (value = "startTime" ,required = false) String startTime,
                                                @RequestParam (value = "endTime",required = false) String endTime
    ) {

        return stRsvrRService.getHistoryValue(  stcd,type,startTime,endTime);
    }

    @GetMapping("ex_latest_value")
    @Operation(summary = "获取雷达水位计、称重式雨量计、气泡式水位计最新值")
    public List<GetLastValueVO> getExLatestValue() {
        return stRsvrRService.getExLatestValue();
    }

    @GetMapping("WaterLatestValue")
    @Operation(summary = "获取各水位站站最新值")
    public List<GetLastValueVO> getWarterLatestValue() {

        return stRsvrRService.getWarterLatestValue();
    }
    @Operation(summary = "获取应急名单")
    @GetMapping("getEmergencyUser")
    public List<EmergencyUserVO> getEmergencyUser(String type, String keyword){
        return zEmergencyUserService.getEmergencyUser(type,keyword);
    }

    /**
     * 洪水预报查询溢洪道下泄能力
     *
     * @param opening
     * @return
     */
    @GetMapping("/getDischargeCapacityDateByeOPening")
    public List<DischargeCapacityVO> getDischargeCapacityDateByeOPening(@RequestParam(value = "opening", required = false) String opening) {
        return zEmergencyUserService.getDischargeCapacityDateByeOPening(opening);

    }

    /**
     * 洪水预报查询排沙底孔下泄能力
     *
     * @return
     */
    @GetMapping("/getSandflushin")
    public List<DischargeCapacityVO> getSandflushin() {
        return zEmergencyUserService.getSandflushin();

    }


    /**
     * 洪水预报查询耦合下泄曲线
     *
     * @return
     */
    @GetMapping("/getCoupledLeakage")
    public List<DischargeCapacityVO> getCoupledLeakage() {
        return zEmergencyUserService.getCoupledLeakage();
    }
    /**
     * 库容复核工作(库容曲线)
     *
     * @return
     */
    @GetMapping("getRzW")
    public List<RzWRelationVO> getRzW() {
        return zEmergencyUserService.getRzW();
    }


    @Operation(summary = "水事巡查统计")
    @GetMapping("getWaterLawEnforcementCountNew")
    public PubPointCountVO getWaterLawEnforcementCounts(@RequestParam(value = "year",required = false) Integer year) {

        return  zEmergencyUserService.getWaterLawEnforcementCounts(year);
    }

    /**
     * 管理制度文档
     *
     * @return
     */
    @GetMapping("getFileByType")
    public List<PubCommonFileVO> getFileByType(@RequestParam(value = "type", required = false) Integer type) {
        return zEmergencyUserService.getFileByType(type);
    }
    /**
     * 根据时间获取工程巡查统计
     */
    @GetMapping("countPatrolByYear")
    public PatrolCountVO countPatrolByYear(@RequestParam(value = "year", required = false) String year) {
        return zEmergencyUserService.countPatrolByYear(year);
    }


    /**
     * 巡检详情
     */
    @GetMapping("getpatrolDate")
    public DsmPtrRecordCountVO getpatrolDate(@RequestParam(value = "year", required = false) String year
            , @RequestParam(value = "type", required = false) Integer type
            ,@RequestParam(value = "mounth",required = false) Integer mounth) {
        return zEmergencyUserService.getpatrolDate(year, type,mounth);
    }
    @GetMapping("getpatrolList")
    public List<PtrRecordDetailVO> getpatrolList(String id) {
        return zEmergencyUserService.getpatrolList(id);
    }
    @GetMapping("getpatrolDataYear")
    public List<String> getpatrolDataYear() {
        return zEmergencyUserService.getpatrolDataYear();
    }
    /**
     * 根据类型获取测点状态
     */
    @GetMapping("countPointByTypes")
    public List<PubPointCountVO> countPointByTypes(@RequestParam(value = "type", required = false) String type) {
        return pubPointAllService.countPointByTypes(type);
    }

    /**
     * 根据类型获取泄洪曲线
     */
    @GetMapping("getRzRation")
    public List<RzRationVO> countPointByTypes(@RequestParam(value = "type", required = false) Integer type) {
        return pubPointAllService.getRzRation(type);
    }


}
